<%@page contentType="text/html" pageEncoding="UTF-8"%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="layout" uri="/WEB-INF/tlds/layout.tld" %>

<layout:head>
    <%-- Insert extra scripts and styles here --%>
</layout:head>

<layout:body handler="Question" onLoad="submitForm('loadQuestions');" form="true">
    <input type="hidden" name="OFFSET" value="0">
    <input type="hidden" name="LIMIT" value="10">

    <table>
        <tr>
        <h3>Perguntas Cadastradas:</h3>
    </tr>

    <tr>
        <% int index=0;%>
        <c:forEach var="question" items="${QUESTIONS}">
            <%-- PERGUNTAS ... definido no servlet (controller) --%>
            <%-- ou referencia ao metodo get caso a classe
                fosse instanciada com jsp:useBean --%>

        <tr valign="center">
            <td><%= index + " - "%></td>
            <td><input type="text" name="question" value="${question}"></td>
            <td><input type="img" onclick="delQues" src="img/Delete"></td>
        </tr>
        <% index++;%>
    </c:forEach>
        <input type ="button" name="newQuestion" value="Nova" alt="Adiciona uma nova pergunta"><br><br><br>
        <input type="submit" name="submitQuestion" value="Salvar" alt="Salva as alterações efetuadas">&nbsp;&nbsp;&nbsp;
        <input type="reset" name="ClQuestion" value="Limpar Tudo" alt="Apaga todas as perguntas">&nbsp;&nbsp;&nbsp;
        <input type="button" name="ReloadQuestion" value="Cancelar" alt="Cancela as alterações efetuadas que ainda não foram enviadas">
</tr>
</table>

</layout:body>